<?php

class Morevalidation
{
    public function _validation_recaptcha($val, $reCaptcha)
    {
        if ($reCaptcha->is_valid($_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]))
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    public function _validation_unique($val, $options)
    {
        list($table, $field) = explode('.', $options);

        $result = DB::select("LOWER (\"$field\")")
            ->where("$field", '=', MBSTRING ? mb_strtolower($val) : strtolower($val))
            ->from($table)->execute();

        if($result->count() > 0)
        {
            return false;
        }
        else
        {
            return true;
        }
    }
}
